// Loesung_von_Aufgabe_2.1.4_4_Luftreibung

float v; // Geschwindigkeit der Kugel
float s; // Fallstrecke der Kugel zur Zeit t
float g = 9.81; // Erdbeschleunigung
float aL; // Beschleunigung gegen die Erdbeschleunigung durch die Luftreibung
float k = 0.015; //Konstante
float t; // Zeit

void setup()
{
  size(400, 400);
}

void draw()
{
  background(255);

  t = t + 1.0/frameRate;
  v = v + (g - aL) * 1.0/frameRate;
  aL = k * v * v;
  s = s + v * 1.0/frameRate;
 
  fill(255, 0, 0);
  ellipse(300, s, 20, 20);

  fill(0, 0, 255); // Textfarbe
  textSize(20); // Textgröße
  text("v in m/s = " +(float)round(100*v)/100, 20, 50);  

  println("aL = ", +aL, "v = ", +v, "s = ", +s, "t = ", +t);

  if (s >= 400)
  {
    noLoop();
  }
}